﻿// JScript 文件
var choose=function(t,s){
    var json = [];
    var term = $F("Term");
    var year = $F("TrueYear");
    var course = $F("StuCourse");
    var week = [];
    var day = s;//获取星期
    var times = t;//获取时间段
    var labroom = $F("lab");
//    alert("y:"+year+"t:"+term+"w"+week+"d:"+day+"t"+t);
    for(var i=1;i<=23;i++)
    {
        if($("checkbox"+i).checked){
            week.push($F("checkbox"+i));
        }
    }
    if(week.length==0){
        alert("你没有选择哪几个星期进行实验课");
        return ;
    }
    json.push({"year":year});
    json.push({"term":term});
    json.push({"week":week});
    json.push({"day":day});
    json.push({"time":times});
    json.push({"course":course});
    json.push({"labroom":labroom});
    var object = {};
    json.each(function(j){
        Object.extend(object, j)
    });
    //alert(Object.toJSON(object));
    var url = "../services/Schedule.ashx";
    var pars = Object.toQueryString(object);
    alert(pars);
    new Ajax.Request(url,{
        method: 'get',
        parameters:pars,
        onSuccess: function(transport) {
             //alert(transport.status);
        },
        onFailure:function(){
            alert('请求失败');
            return ;
        }
     });
}
